home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java for 3D & VRML Worlds
/
Java for 3d and VRML Worlds.iso
/
world
/
blur1
/
blur1.java
< prev
next >
Wrap
Text File
|
1996-10-17
|
2KB
|
105 lines
// "Simple Blur Effect" with two blur objects
// created by ask@krc.sony.co.jp (Masamichi zzzcat Asukai)
//
// Copyright(C) 1996 Sony Corporation. All rights reserved.
//
import vrml.*;
import vrml.node.*;
import vrml.field.*;
public class blur1 extends Script {
private SFVec3f setTranslation;
private SFVec3f setTranslation2;
private float[] translation = new float[3];
private float[] translation_old = new float[3];
private Node realobj;
// constructor
public void initialize() {
setTranslation = (SFVec3f)getEventOut("setTranslation");
setTranslation2 = (SFVec3f)getEventOut("setTranslation2");
realobj = (Node)((SFNode)getField("realobj")).getValue();
// get translation of real object
((SFVec3f)realobj.getExposedField("translation")).getValue(translation);
translation_old[0] = translation[0];
translation_old[1] = translation[1];
translation_old[2] = translation[2];
}
public void processEvent(Event e) {
if (e.getName().equals("interval")) {
// set translation of blur object
setTranslation.setValue(translation);
setTranslation2.setValue(translation_old);
// save old translation
translation_old[0] = translation[0];
translation_old[1] = translation[1];
translation_old[2] = translation[2];
// get translation of real object
((SFVec3f)realobj.getExposedField("translation")).getValue(translation);
}
}
}